package com.example.exception;

import com.example.common.AppResult;

/**
 * Created with IntelliJ IDEA.
 * Description:自定义异常类
 * User: bjc
 * Date: 2025-09-03
 * Time: 11:01
 */
public class ApplicationException extends RuntimeException{
    private AppResult errResult;

    public ApplicationException(AppResult errResult) {
        super(errResult.getErrMsg()); //调用父类的有参构造方法，这样父类就可以获取到错误信息
        this.errResult = errResult;
    }
    //自定义异常描述
    public ApplicationException(String message) {
        super(message);
    }
    //自定义异常描述和异常原因
    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }
    //自定义异常原因
    public ApplicationException(Throwable cause) {
        super(cause);
    }
    //获取异常结果
    public AppResult getErrResult() {
        return errResult;
    }
}
